Danish updates from David Munch
[adiumx.git] / Plugins / Purple Service / ESPurpleRequestAbstractWindowController.m
bloba93932f76ba357f82d5a055607c60534f1a5d4a7
1 //
2 //  ESPurpleRequestAbstractWindowController.m
3 //  Adium
4 //
5 //  Created by Evan Schoenberg on 9/22/05.
6 //
8 #import "ESPurpleRequestAbstractWindowController.h"
9 #import "adiumPurpleRequest.h"
11 @implementation ESPurpleRequestAbstractWindowController
13 - (id)initWithWindowNibName:(NSString *)windowNibName
15         if ((self = [super initWithWindowNibName:windowNibName])) {
16                 windowIsClosing = NO;
17         }
18         
19         return self;
22 /*!
23  * @brief This is where subclasses should generally perform actions they would normally do in windowWillClose:
24  *
25  * ESPurpleRequestAbstractWindowController calls this method only when windowWillClose: is triggered by user action
26  * as opposed to libpurple closing the window.
27  */
28 - (void)doWindowWillClose {};
30 - (void)windowWillClose:(id)sender
32         [super windowWillClose:sender];
33         
34         if (!windowIsClosing) {
35                 windowIsClosing = YES;
36                 [self doWindowWillClose];
37                 
38                 //Inform libpurple that the request window closed
39                 [ESPurpleRequestAdapter requestCloseWithHandle:self];
40         }
41 }       
43 /*!
44  * @brief libpurple has been made aware we closed or has informed us we should close
45  *
46  * Close our requestController's window if it's open; then release (we returned without autoreleasing initially).
47  */
48 - (void)purpleRequestClose
50         if (!windowIsClosing) {
51                 windowIsClosing = YES;
52                 [self closeWindow:nil];
53         }
54         
55         [self release];
58 @end